
# ifndef __DFX_MATERIAL_H__
# define __DFX_MATERIAL_H__

# include "dfxCore.h"
# include "dfxColor4.h"
# include "dfxTexture.h"
# include "dfxProgram.h"
# include "dfxRenderState.h"

namespace DFX
{
    class DFX_EXPORT Material
    {
    protected:

        UInt32      mType;
        UInt32      mNumPasses;
        UInt32      mActivePass;
                
    public:

        Material(UInt32 type)
            : mType(type), mNumPasses(1), mActivePass(0)
        {
        }
        
        virtual ~Material()
        {
        }

        UInt32 GetType() const
        {
            return mType;
        }

        UInt32 GetNumPasses() const
        {
            return mNumPasses;
        }

        UInt32 GetActivePass() const
        {
            return mActivePass;
        }

        virtual void SetActivePass(UInt32 activePass)
        {
            mActivePass = activePass;
        }

        virtual DFXRESULT Begin()
        {
            return DFX_SUCCESS;
        }

        virtual void End()
        {
        }

        virtual UInt32 GetNumTextures() = 0;
        virtual UInt32 GetTextureLoc(UInt32 unit) = 0;

        virtual Texture* GetTexture(UInt32 unit) = 0;
        virtual Program* GetProgram() = 0;

        virtual AlphaState* GetAlphaState() = 0;
        virtual RasterizerState* GetRasterizeState() = 0;
        virtual DepthState* GetDepthState() = 0;
        virtual StencilState* GetStencilState() = 0;
    };

    typedef std::vector<Material*>      MaterialArray;
    typedef MaterialArray::iterator     MaterialIterator;
}

# endif